from datetime import date
import json

from django.conf import settings
from rest_framework import serializers
from rest_framework_simplejwt.tokens import RefreshToken
from rest_framework_simplejwt.settings import api_settings

from .models import Account


class CompanySerializer(serializers.ModelSerializer):

    def to_representation(self, instance):
        ret = super().to_representation(instance)
        ret['company_name'] = instance.username
        return ret

    class Meta:
        model = Account
        fields = []


class AccountSerializer(serializers.ModelSerializer):

    def to_representation(self, instance):
        ret = super().to_representation(instance)
        ret['company_name'] = instance.username
        return ret

    class Meta:
        model = Account
        fields = ['username', 'realname', 'id', 'address', 'telephone']
